package com.mallcloud.mall.common.core.constant.enums.app;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;

/**
 * 微信支付
 */
@Getter
@AllArgsConstructor
public enum WxPayEnum {

	//字典
	REDEEM_STATUS("REDEEM_STATUS", "积分兑换状态字典"),
	;

	private final String type;
	private final String description;

	@Getter
	@RequiredArgsConstructor
	public enum TradeTypeEnum {
		JSAPI("公众号支付"),
		NATIVE("扫码支付"),
		APP("APP支付"),
		MICROPAY("付款码支付"),
		H5("H5支付"),
		MWEB("H5支付"),
		FACEPAY("刷脸支付"),
		SUB_JSAPI("小程序jsapi支付"),
		;
		private final String status;

		public static String getDecs(String code) {
			return Arrays.stream(values()).filter(x -> x.name().equals(code)).findFirst().get().getStatus();
		}
	}

	@Getter
	@RequiredArgsConstructor
	public enum TradeStateEnum {
		SUCCESS("支付成功"),
		REFUND("转入退款"),
		NOTPAY("未支付"),
		CLOSED("已关闭"),
		REVOKED("已撤销（付款码支付）"),
		USERPAYING("用户支付中（付款码支付)"),
		PAYERROR("支付失败"),
		;
		private final String status;

		public static String getDecs(String code) {
			return Arrays.stream(values()).filter(x -> x.name().equals(code)).findFirst().get().getStatus();
		}
	}

	@Getter
	@RequiredArgsConstructor
	public enum RefundStateEnum {
		SUCCESS("退款成功"),
		CLOSED("退款关闭"),
		ABNORMAL("退款异常，可前往【商户平台—>交易中心】，手动处理此笔退款"),
		;
		private final String status;

		public static String getDecs(String code) {
			return Arrays.stream(values()).filter(x -> x.name().equals(code)).findFirst().get().getStatus();
		}
	}



}
